home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 8.7 KB | 252 lines | [TEXT/MPS ] |
- ;
- ; File: DeviceNotify.a
- ;
- ; Contains: xxx put contents here xxx
- ;
- ; Version: Technology: xxx put the technology version here xxx
- ; Release: Universal Interfaces 3.0d3 on Copland DR1
- ;
- ; Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
- ;
- ; Bugs?: If you find a problem with this file, send the file and version
- ; information (from above) and the problem description to:
- ;
- ; Internet: apple.bugs@applelink.apple.com
- ; AppleLink: APPLE.BUGS
- ;
- ;
- IF &TYPE('__DEVICENOTIFY__') = 'UNDEFINED' THEN
- __DEVICENOTIFY__ SET 1
-
- IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
- include 'Types.a'
- ENDIF
- IF &TYPE('__KERNEL__') = 'UNDEFINED' THEN
- include 'Kernel.a'
- ENDIF
- IF &TYPE('__NAMEREGISTRY__') = 'UNDEFINED' THEN
- include 'NameRegistry.a'
- ENDIF
- IF FOR_SYSTEM8_PREEMPTIVE THEN
- ;
- ; §
- ;##############################################################################
- ;
- ; File Name: DeviceNotifyPriv.h
- ;
- ; Description:
- ; The device notification service is used by Copland Kernel band
- ; Low level family expert code to inform high level "consumers" about
- ; hot plugging/un-plugging of devices.
- ;
- ; The High level families or code modules running in priviledged mode
- ; can subscribe to the service with the DevNRegisterInterestIn().
- ; LL Family notifies its consumers through the DevNNotifyThatThisChanged().
- ;
- ;##############################################################################
- ;############################
- ; Defines
- ;############################
- ;
- ; typedef UInt32 DevNRef
-
- ;
- ; a connection Reference Num for a particular subscription
- ; a consumer subscription is identified by a unique
- ; DevNSubRef. In order to cancel a consumer registration,
- ; the DevNSubRef must be specified.
- ;
- ; a Reference Num for a particular notification
- ; A notification is identified by a unique DevNRef,
- ; since a notification can go through couple of states, and
- ; it needs to be tracked with a unique identifier.
- ;
- ;
- ;
- ; §
- ;########################################################################
- ; Known & valid Service Category definitions are defined in DFM.h
- ;########################################################################
- ;
-
- kDevNAllServiceCategories EQU $FFFFFFFF ; an option to subscribe to ALL valid service catagories
-
- kMaxNumServiceCategories EQU 20 ; ••• should be in DFM.h •••
- ;
- ; §
- ;########################################################################
- ; Event definition:
- ; If kDevNSoftRequestMask is set in conjunction with an event value,
- ; then a soft request is indicated, and the DevN will handle all the
- ; drudgery associated with two-way transactions, etc.
- ; (e.g. If (kDevNRemoved and kDevNSoftRequestMask) is received, it's
- ; a soft eject request)
- ; If kDevNSoftRequestMask is NOT set, then it's a hard request
- ; If the kDevNWarningMask is set, then it's an event warning that
- ; a given event is about to happen (and the consumer can't do a thing
- ; about it). It will be followed later on by a gone hard event.
- ; the kDevNWarningMask and the kDevNSoftRequestMask can NOT be set at
- ; the same time.
- ;########################################################################
- ;
- ; typedef UInt32 DevNEventType
-
- ;
- ; pre-defined event mask
- ; §
- ; definition of valid global event
- ; (10/11/95) Events are now enum instead of masks
- ; enum for "unsigned" values
- ;
-
- kDevNSoftRequestMask EQU $80000000 ; bit indicating soft request
- kDevNWarningMask EQU $40000000 ; bit indicating a warning request
- kDevNAdded EQU 0 ; New device/media/bus available
- kDevNRemoved EQU 1 ; Existing device/media/bus now gone
- kDevNWakeup EQU 2 ; Plug-in sw state no longer needs synchronization
- kDevNSleep EQU 3 ; Ask to synchronize SOFTWARE state of plug-in
- ; …used by PowerMgr, DriverReplacer, Soft Dev Eject
- kDevNBootComplete EQU 4 ; used by motherboard expert to inform DFM boot complete
- kDevNIOInitComplete EQU 5 ; I/O system initialize complete
- kDevNNumOfPredefinedEvtInUse EQU 6
- kDevNHighestEvtInUse EQU 5
- ; enum for "signed" values
-
- kDevNSoftEject EQU $80000001 ; (kDevNRemoved | kDevNSoftRequestMask)
- ;
- ; §
- ;########################################################################
- ; Routine return value definition
- ;########################################################################
- ;
- ; typedef UInt32 DevNPermissionResponse
-
- ; status returned by consumer to DevN
-
- kDevNPermissionGranted EQU 0 ; consumer consented that instant removal of
- ; node is OK
- kDevNPermissionDelayed EQU 1 ; can not grant permission now, will inform producer through .
- ; DevN at a later time (ignored by the DevN if hard request)
- kDevNPermissionDenied EQU 2 ; do Not allow requested event to take place
- ; (ignored by the DevN if hard request)
- kDevNValidPermissionMasks EQU 3
- ;
- ;########################################################################
- ; Error code definition
- ;########################################################################
- ;
-
- kDevNMErrorCodeBase EQU 0
- kInvalidSC EQU 1 ; subscribe with invalid Service Category code
- kInvalidEvent EQU 2 ; subscribe with invalid event mask (zero)
- kInvalidHandler EQU 3 ; subscribe with NULL handler address
- kNoSuchRef EQU 4 ; Specified ID can not be found
- kRecordNotFound EQU 5 ; while unregistering, can not find record in array
- kNotEnoughEventMask EQU 6 ; not enough masks for DevNMCreateNewEvent call
- kDeleteInvalidMasks EQU 7 ; attempt to DevNMDeleteNewEvent on invalid event masks
- kInvalidEventCount EQU 8 ; invalid event count parameter being passed in
- kInvalidPermission EQU 9 ; bad permission returned from consumer
- kTokenNotFound EQU 10 ; sub record lookup list token not found
- ;
- ;########################################################################
- ; Subroutine Prototype
- ;########################################################################
- ; no more handlers
- ;######################
- ; called by consumer
- ;######################
- ;
- ;
- ; extern OSStatus DevNRegisterInterestIn(OSType myFamily, ItemCount eventCount, DevNEventType *events, ObjectID adminMessageObj, DevNRef *thisRegistration, void *parm)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION DevNRegisterInterestIn
- ENDIF
-
- ;
- ; extern OSStatus DevNUnregisterInterest(DevNRef thisID)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION DevNUnregisterInterest
- ENDIF
-
- ;
- ; extern OSStatus DevNMCreateNewEvent(DevNEventType *result)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION DevNMCreateNewEvent
- ENDIF
-
- ;
- ; call to register family defined events.
- ; itemCount specifies how many events are desired
- ; (Only create one event at a time)
- ;
- ;
- ; extern OSStatus DevNMDeleteNewEvent(DevNEventType event)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION DevNMDeleteNewEvent
- ENDIF
-
- ; de-register the given event
- ;
- ; extern OSStatus DevNDelayedDownwardNotify(DevNRef notifyRef, DevNRef subscriptionRef, DevNPermissionResponse permission)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION DevNDelayedDownwardNotify
- ENDIF
-
- ;
- ; must be called after an kDevNPermissionDelayed is returned to the DevN
- ; for a notification response.
- ;######################
- ; called by producer
- ;######################
- ;
- ;
- ; extern DevNPermissionResponse DevNNotifyThatThisChanged(OSType whichServiceCategory, DevNEventType whatHappened, RegEntryRef *whichDevice, ObjectID adminMessageObj, DevNRef *notRef, void *parm)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION DevNNotifyThatThisChanged
- ENDIF
-
- ;
- ; extern DevNPermissionResponse DevNNotifyEvents(DevNEventType whatHappened, RegEntryRef *whichDevice, ObjectID adminMessageObj, DevNRef *notRef, void *parm)
- ;
- IF GENERATINGCFM THEN
- IMPORT_CFM_FUNCTION DevNNotifyEvents
- ENDIF
-
- ;
- ;#####################################
- ; Notification Message definitions
- ;#####################################
- ;
- DevNMessage RECORD 0
- AdminMessageType ds.l 1 ; offset: $0 (0)
- subMessageType ds.l 1 ; offset: $4 (4)
- serviceCategory ds.l 1 ; offset: $8 (8)
- event ds.l 1 ; offset: $C (12)
- device ds.l 1 ; offset: $10 (16)
- parm ds.l 1 ; offset: $14 (20)
- notRef ds.l 1 ; offset: $18 (24)
- returnPermission ds.l 1 ; offset: $1C (28)
- sizeof EQU * ; size: $20 (32)
- ENDR
- ;
- ;#########################################################
- ; Device Notification sub-message types.
- ; (This is in the "subMessageType" field inside
- ; The DevNMessage structure)
- ;#########################################################
- ;
-
- kDevNNotifyMsg EQU $01
- kDevNNotifyCancel EQU $02
- kDevNNotifyDelayedReply EQU $03
- kNextUnusedMsg EQU $04
- ENDIF
- ENDIF ; __DEVICENOTIFY__
-
-